import logging

from config import URL
import requests

class  Emp():
    def __init__(self,url_path='/api/sys/user'):
        self.url=URL+url_path

    def add_emp(self,body,headers):
        resp=requests.post(self.url,json=body,headers=headers)
        return resp
    def find_emp(self,id_emp,headers):
        url_find=self.url+f'/{id_emp}'
        resp_find=requests.get(url_find,headers=headers)
        return resp_find
    def update_emp(self,id_emp,body_update,headers):
        url_update=self.url+f'/{id_emp}'
        resp_update=requests.put(url_update,json=body_update,headers=headers)
        return resp_update
    def delete_emp(self,id_emp,headers):
        url_delete = self.url + f'/{id_emp}'
        resp_delete=requests.delete(url_delete,headers=headers)
        return resp_delete


